package com.game.service.imp;

import javax.jms.Topic;

import org.apache.activemq.ActiveMQMessageProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import com.game.service.IProducer;
@Component
public class ActiveMqProducer implements IProducer{

	private static final Logger log = LoggerFactory.getLogger(ActiveMQMessageProducer.class);
	@Autowired
	private JmsMessagingTemplate  jmsTemplate;
	@Autowired
	private Topic topic;
	
	public void sendMessage(String message){
		log.info("sendMessage 发送消息{}"+message);
		jmsTemplate.convertAndSend(topic,message);
	}
}
